﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace EasyTrader.Form
{
    public partial class CPDataDownloadSetting : System.Windows.Forms.Form
    {
        public System.Timers.Timer FutOptChartTimer = null;
        public System.Timers.Timer FutureMstTimer = null;
        public System.Timers.Timer CmeMstTimer = null;
        public System.Timers.Timer CPSvrNew7221Timer = null;
        public System.Timers.Timer SubscribeDataTimer = null;

        public CPDataDownloadSetting()
        {
            InitializeComponent();
        }

        public CPDataDownloadSetting(
            System.Timers.Timer a_FutOptChartTimer,
            System.Timers.Timer a_FutureMstTimer,
            System.Timers.Timer a_CmeMstTimer,
            System.Timers.Timer a_CPSvrNew7221Timer,
            System.Timers.Timer a_SubscribeDataTimer
            )
        {
            InitializeComponent();
            FutOptChartTimer = a_FutOptChartTimer;
            FutureMstTimer = a_FutureMstTimer;
            CmeMstTimer = a_CmeMstTimer;
            CPSvrNew7221Timer = a_CPSvrNew7221Timer;
            SubscribeDataTimer = a_SubscribeDataTimer;
        }

        private void nudFutOptChartTimerInterval_ValueChanged(object sender, EventArgs e)
        {
            GlobalVar.FutOptChartTimerInterval = (int)nudFutOptChartTimerInterval.Value * 1000;
        }

        private void cbFutOptChartTimerAutoStart_CheckedChanged(object sender, EventArgs e)
        {
            if (cbFutOptChartTimerAutoStart.Checked)
            {
                GlobalVar.FutOptChartTimerAutoStart = true;
            }
            else
            {
                GlobalVar.FutOptChartTimerAutoStart = false;
            }
        }

        private void cbFutOptChartEnable_CheckedChanged(object sender, EventArgs e)
        {
            if (cbFutOptChartEnable.Checked)
            {
                GlobalVar.FutOptChartEnabled = true;
            }
            else
            {
                GlobalVar.FutOptChartEnabled = false;
            }
        }

        private void cbCPSvrNew7221TimerAutoStart_CheckedChanged(object sender, EventArgs e)
        {
            if (cbCPSvrNew7221TimerAutoStart.Checked)
            {
                GlobalVar.CPSvrNew7221TimerAutoStart = true;
            }
            else
            {
                GlobalVar.CPSvrNew7221TimerAutoStart = false;
            }
        }

        private void cbCPSvrNew7221TimerEnable_CheckedChanged(object sender, EventArgs e)
        {
            if (cbCPSvrNew7221TimerEnable.Checked)
            {
                GlobalVar.CPSvrNew7221Enabled = true;
            }
            else
            {
                GlobalVar.CPSvrNew7221Enabled = false;
            }
        }

        private void nudCPSvrNew7221TimerInterval_ValueChanged(object sender, EventArgs e)
        {
            GlobalVar.CPSvrNew7221TimerInterval = (int)nudCPSvrNew7221TimerInterval.Value * 1000;
        }

        private void cbFutureMstTimerAutoStart_CheckedChanged(object sender, EventArgs e)
        {
            if (cbFutureMstTimerAutoStart.Checked)
            {
                GlobalVar.FutureMstTimerAutoStart = true;
            }
            else
            {
                GlobalVar.FutureMstTimerAutoStart = false;
            }
        }

        private void cbFutureMstTimerEnable_CheckedChanged(object sender, EventArgs e)
        {
            if (cbFutureMstTimerEnable.Checked)
            {
                GlobalVar.FutureMstEnabled = true;
            }
            else
            {
                GlobalVar.FutureMstEnabled = false;
            }
        }

        private void nudFutureMstTimerInterval_ValueChanged(object sender, EventArgs e)
        {
            GlobalVar.FutureMstTimerInterval = (int)nudFutureMstTimerInterval.Value * 1000;
        }

        private void cbCmeMstTimerAutoStart_CheckedChanged(object sender, EventArgs e)
        {
            if (cbCmeMstTimerAutoStart.Checked)
            {
                GlobalVar.CmeMstTimerAutoStart = true;
            }
            else
            {
                GlobalVar.CmeMstTimerAutoStart = false;
            }
        }

        private void cbCmeMstTimerEnable_CheckedChanged(object sender, EventArgs e)
        {
            if (cbCmeMstTimerEnable.Checked)
            {
                GlobalVar.CmeMstEnabled = true;
            }
            else
            {
                GlobalVar.CmeMstEnabled = false;
            }
        }

        private void nudCmeMstTimerInterval_ValueChanged(object sender, EventArgs e)
        {
            GlobalVar.CmeMstTimerInterval = (int)nudCmeMstTimerInterval.Value * 1000;
        }

        private void cbFutureCurOnlyEnable_CheckedChanged(object sender, EventArgs e)
        {
            if (cbFutureCurOnlyEnable.Checked)
            {
                GlobalVar.FutureCurOnlyEnabled = true;
            }
            else
            {
                GlobalVar.FutureCurOnlyEnabled = false;
            }
        }

        private void cbFutureJpBidEnable_CheckedChanged(object sender, EventArgs e)
        {
            if (cbFutureJpBidEnable.Checked)
            {
                GlobalVar.FutureJpBidEnabled = true;
            }
            else
            {
                GlobalVar.FutureJpBidEnabled = false;
            }
        }

        private void cbCmeCurrEnable_CheckedChanged(object sender, EventArgs e)
        {
            if (cbCmeCurrEnable.Checked)
            {
                GlobalVar.CmeCurrEnabled = true;
            }
            else
            {
                GlobalVar.CmeCurrEnabled = false;
            }
        }

        private void cbSubscribeDataTimerAutoStart_CheckedChanged(object sender, EventArgs e)
        {
            if (cbSubscribeDataTimerAutoStart.Checked)
            {
                GlobalVar.SubscribeDataTimerAutoStart = true;
            }
            else
            {
                GlobalVar.SubscribeDataTimerAutoStart = false;
            }
        }

        private void nudSubscribeDataTimerInterval_ValueChanged(object sender, EventArgs e)
        {
            GlobalVar.SubscribeDataTimerInterval = (int)nudSubscribeDataTimerInterval.Value * 1000;
        }

        private void cbCPSvrNew7221SEnable_CheckedChanged(object sender, EventArgs e)
        {
            if (cbCPSvrNew7221SEnable.Checked)
            {
                GlobalVar.CPSvrNew7221SEnabled = true;
            }
            else
            {
                GlobalVar.CPSvrNew7221SEnabled = false;
            }
        }

        private void cbCPSvr8111SEnable_CheckedChanged(object sender, EventArgs e)
        {
            if (cbCPSvr8111SEnable.Checked)
            {
                GlobalVar.CPSvr8111SEnabled = true;
            }
            else
            {
                GlobalVar.CPSvr8111SEnabled = false;
            }
        }
    }
}
